Conversation
|
Build is failing since I upgraded from exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-java-services'@ivovandongen can you review this one? |
|
@cammace The Distance related code seems good. There is a lot in there that doesn't seem to belong to this PR though (images, dependency updates). Would be great to separate these for easier reviews/traceability. |
c9d8cd4 to
d3a2f31
Compare
|
Cleaned up PR and moved some changes into #223. |
| setSupportActionBar(toolbar); | ||
| getSupportActionBar().setDisplayHomeAsUpEnabled(true); | ||
|
|
||
| coordinates = new ArrayList<>(); |
There was a problem hiding this comment.
Initialisation can go into the field declaration as it's only done once anyway. That way you can make them final and there's no chance of null pointer exceptions (when refactoring)
| @Override | ||
| public void onMapClick(@NonNull LatLng point) { | ||
|
|
||
| features = new ArrayList<>(); |
There was a problem hiding this comment.
replace with clear and initialise in declaration
|
|
||
| features.addAll(mapboxMap.queryRenderedFeatures(pixel, "circle-layer")); | ||
|
|
||
| if (features.size() <= 0) { |
There was a problem hiding this comment.
Might want to do the opposite here; size() > 0 -> callDistanceApi() and have just a single exit point in the method
| for (int i = 0; i < restaurants.size(); i++) { | ||
| // Get the json object and replace the duration property with the updated time. We convert the API's | ||
| // second value to minutes. | ||
| JsonObject jsonObject = restaurants.get(i).getProperties().getAsJsonObject(); |
| restaurants.get(i).getStringProperty("name") + "-layer-name", | ||
| restaurants.get(i).getStringProperty("name") + "-source" | ||
| ).withProperties( | ||
| PropertyFactory.textSize(14f), |
There was a problem hiding this comment.
Can be shortened with static import
| */ | ||
| @Override | ||
| public Geometry deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) | ||
| throws JsonParseException { |
There was a problem hiding this comment.
Indentation looks a bit off here. Or is that the new code style?
There was a problem hiding this comment.
it's the new style, line 31 is over the max line length so I broke it up by adding throws on the line below.
d3a2f31 to
6ecb82b
Compare
Closes #168
Adds the Distance API to mapbox-java. Still need to add test and clean up some of them code. Example activity can be found in testapp:
cc: @mapbox/android